<?php
/*
 * @Author: your name
 * @Date: 2020-10-26 13:42:53
 * @LastEditTime: 2020-12-17 13:34:39
 * @LastEditors: Please set LastEditors
 * @Description: 防火墙主机列表验证器
 * @FilePath: /special/application/adminapiv3/validate/NetfilterHostValidate.php
 */
namespace app\adminapiv3\validate;

use think\Validate;

class NetfilterHostValidate extends Validate
{
    protected $rule = [
        //资产名
        'name|资产名称' => 'length:1,50',
        //资产ip
        'ip|主机IP地址' => 'regex:^\d{1,3}(\.\d{1,3}){0,3}$',
        //主机系统类别 1windows 2Linux
        'os|主机系统类别' => 'in:0,1,2',
        //标签
        'tag|主机标签' => 'number|length:1,10',
        //学习状态
        'learn_status|学习状态' => 'in:0,1',
        //是否在线
        'online|是否在线' => 'in:0,1'
    ];


    protected $message = [
        'os.in' => '主机系统类别格式错误',
        'learn_status.in' => '学习状态格式错误',
        'online.in' => '是否在线格式错误',
    ];

    protected $scene = [
        'listFilter' => ['name','ip','os','tag','learn_status','online'],
    ];
}